package org.example;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo {
    public static  void main(String[] args) throws Exception{

//        car cart1 = new  car();
//        car cart2 = new  car();
//        System.out.println(cart1 == cart2);
//        /**
//         * cart的数据类型为Cart，把new Cart（）的值赋给cart
//         * java遇到new就开辟一个新空间
//         * 比较时是比较两个值得内存地址
//         */
//        cart1.car();
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/dd?serverTimezone=GMT%2B8","root","root");

        String sql = "update student set name = ? where id = ?";
        PreparedStatement pst = conn.prepareStatement(sql);

        int i = pst.executeUpdate();
        if(i!=0){
            System.out.println("插入成功");
        }
        else System.out.println("插入失败");

        pst.close();
        conn.close();
    }
}
